(function(){
    function Minion(){
        var breadcrumb = new Breadcurmb({
            prefix: [
                {text: '主机管理', anchor: '/task'}
            ],
            curr: '节点列表'
        });

        var MainView = Backbone.View.extend({
            // el与initialize一样是bk的关键字, 不能重命名为其它
            el: '#page-cnt',
            template:  _.template($("#tpl-minion").html()),
            events: {},
            initialize: function() {
                // 创建面包屑视图
                this.breadcrumbView = new BreadcrumbView({
                    model: breadcrumb
                });
                this.render();
            },
            render: function(){
                this.$el.html(this.template());
                // 只有模板渲染后才能加载表格插件
                this.tableView = new TableView({
                    el: '#minion .bootstrap-table',
                    columns: [
                        {field: 'minionId',     title: '节点ID'},
                        {field: 'hwareId',    title: '硬件ID'},
                        {field: 'kernel',     title: '内核版本'},
                        {field: 'cpu',     title: 'cpu核心'},
                        {field: 'memory',     title: '内存问题'},
                        {field: 'os',     title: '系统类型'},
                        {field: 'osrelease',     title: '系统版本'},
                        {field: 'pyversion',     title: 'python版本'},
                        {field: 'saltpath',     title: 'salt路径'},
                        {field: 'saltversion',     title: 'salt版本'},
                        {field: 'osarch',     title: '系统架构'},
                        {field: 'cpuarch',     title: 'cpu架构'},
                        {field: 'cpuModel',     title: 'cpu型号'},
                        {field: 'virtual',     title: '虚拟化'},
                        {field: 'mac',     title: 'mac地址'},
                        {field: 'ipv4',     title: 'IP地址'},
                        {field: 'disk',     title: '硬盘'},
                    ],
                    opts: {
                        url: apiList.minion.query,
                        toolbar: '#minion .toolbar',
                    },
                    eventBus: this.eventBus
                });
            },
        });

        var mainView = new MainView();
        console.log('minion start');

    }

    app.modules.Minion = Minion;

})();